package chongxin;

public class learn5 {
    //属性
    private String name;
    private String sex;
    private int age;
    private String scorebook;
    //无参构造方法
public learn5(){
}
//有参构造方法
    public learn5(String name, String sex, int age, String scorebook) {
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.scorebook = scorebook;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getScorebook() {
        return scorebook;
    }

    public void setScorebook(String scorebook) {
        this.scorebook = scorebook;
    }
    //调用方法
    public void print( String name,String sex,int age){
        setName(name);
        setSex(sex);
        setAge(age);
        System.out.println("姓名为:"+getName()+"性别为:"+getSex()+"年龄为:"+getAge());
}
    public void print1(String name,String sex,int age,String scorebook){
    setName(name);
    setSex(sex);
    setAge(age);
    setScorebook(scorebook);
        System.out.println("姓名为:"+getName()+"性别为:"+getSex()+"年龄为:"+getAge());
}

    public static void main(String[] args) {
    //创建对象
        learn5 th=new learn5();
        //使用类的方法
        th.print("朱玉","男",12);
        th.print1("玉竹","女",24,"Java课程");
}
}
